package com.techsun.lf.loader;

import android.content.ComponentName;
import android.content.Context;

import com.tencent.shadow.core.loader.infos.ContainerProviderInfo;
import com.tencent.shadow.core.loader.managers.ComponentManager;

public class SampleComponentManager extends ComponentManager {
   /**
    * runtime 模块中定义的壳子Activity, 路径类名保持一致，需要在宿主AndroidManifest.xml注册
    */
   private static final String DEFAULT_ACTIVITY = "com.techsun.lf.runtime.PluginDefaultProxyActivity";
   private static final String SINGLE_INSTANCE_ACTIVITY = "com.techsun.lf.runtime.PluginSingleInstance1ProxyActivity";
   private static final String SINGLE_TASK_ACTIVITY = "com.techsun.lf.runtime.PluginSingleTask1ProxyActivity";

   private Context context;

   public SampleComponentManager(Context context) {
      this.context = context;
   }


   /**
    * 配置插件Activity 到 壳子Activity的对应关系
    *
    * @param pluginActivity 插件Activity
    * @return 壳子Activity
    */
   @Override
   public ComponentName onBindContainerActivity(ComponentName pluginActivity) {
      switch (pluginActivity.getClassName()) {
         /**
          * 这里配置对应的对应关系, 启动不同启动模式的Acitvity
          */
      }
      return new ComponentName(context, DEFAULT_ACTIVITY);
   }

   /**
    * 配置对应宿主中预注册的壳子contentProvider的信息
    */
   @Override
   public ContainerProviderInfo onBindContainerContentProvider(ComponentName pluginContentProvider) {
      return new ContainerProviderInfo(
              "com.tencent.shadow.core.runtime.container.PluginContainerContentProvider",
              context.getPackageName() + ".contentprovider.authority.dynamic");
   }
}
